import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DoorEventVO, DoorEventForm, DoorEventQuery } from '@/api/tearoom/doorEvent/types';

/**
 * 查询茶室开门记录列表
 * @param query
 * @returns {*}
 */

export const listDoorEvent = (query?: DoorEventQuery): AxiosPromise<DoorEventVO[]> => {
  return request({
    url: '/tearoom/doorEvent/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询茶室开门记录详细
 * @param eventid
 */
export const getDoorEvent = (eventid: string | number): AxiosPromise<DoorEventVO> => {
  return request({
    url: '/tearoom/doorEvent/' + eventid,
    method: 'get'
  });
};

/**
 * 新增茶室开门记录
 * @param data
 */
export const addDoorEvent = (data: DoorEventForm) => {
  return request({
    url: '/tearoom/doorEvent',
    method: 'post',
    data: data
  });
};

/**
 * 修改茶室开门记录
 * @param data
 */
export const updateDoorEvent = (data: DoorEventForm) => {
  return request({
    url: '/tearoom/doorEvent',
    method: 'put',
    data: data
  });
};

/**
 * 删除茶室开门记录
 * @param eventid
 */
export const delDoorEvent = (eventid: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/doorEvent/' + eventid,
    method: 'delete'
  });
};
